import Vue from 'vue'
import App from './App.vue'
import router from './router'
import './plugins/element.js'
import './assets/css/global.css'
import './assets/fonts/iconfont.css'
import Axios from 'axios'
import LayoutBox from './components/LayoutBox.vue'
import TableTree from 'vue-table-with-tree-grid'
import Moment from 'moment'
import VueQuillEditor from 'vue-quill-editor'
import 'quill/dist/quill.core.css'
import 'quill/dist/quill.snow.css'
import 'quill/dist/quill.bubble.css'
Vue.use(VueQuillEditor, /* { default global options } */)
// 配置请求的根路径
Axios.defaults.baseURL = 'http://127.0.0.1:8888/api/private/v1/'

Axios.interceptors.request.use(config => {
  // console.log(config)
  config.headers.Authorization = window.sessionStorage.getItem('token')
  // 在最后必须 return config
  return config
})


// 把axios引入到vue中 
Vue.prototype.$http = Axios
Vue.config.productionTip = false


// 添加全局组件

Vue.component('layout-box',LayoutBox)
Vue.component('table-tree',TableTree)
// 添加全局的时间过滤器

Vue.filter('dateFormat',function(val){
  return Moment(val).format('YYYY-MM-DD HH:mm:ss')
})

new Vue({
  router,
  render: h => h(App)
}).$mount('#app')


// main.js是项目的主入口
// 所有的js的依赖项都是在这里引入